import ControlScript from "../PublicScript/ControlScript";
import GameData_red_blue_man, {dataName} from "./GameData_red_blue_man";


const {ccclass, property} = cc._decorator;

const tips = [
    "点击左方向键向左移动人物",
    "点击右方向键向右移动人物",
    "现在点击跳跃键",
    "点击视角键，观看全图视角",
    "获得红色钥匙后将人物移动到红色门的位置",
    "点击人物切换键切换人物",
    "拿到钥匙将他移动到蓝色门的位置"
];

@ccclass
export default class NewPlay extends cc.Component {

    @property(cc.Label)
    tipsLabel: cc.Label = null;

    @property(cc.Node)
    maskNode: cc.Node = null;

    @property(cc.Node)
    mask: cc.Node = null;

    @property(cc.Node)
    finger: cc.Node = null;

    // onLoad () {}

    start () {

    }

    init(data){
        console.log(data.position,data.index, data.size);
        if(data.size == 0){
            this.maskNode.active = false;
        }else{
            this.maskNode.active = true;
            this.mask.width = data.size - 20;
            this.mask.height = data.size- 20;
            this.maskNode.setPosition(data.position);
        }
        this.tipsLabel.string = tips[data.index];
        if(data.index == 6){
            this.maskNode.active = false;
            GameData_red_blue_man.settingState["newPlay"] = false;
            GameData_red_blue_man.saveSettingState();
        }
        this.anim();
    }

    anim(){
        cc.tween(this.finger)
            .repeatForever(
                cc.tween()
                .to(0.5, {scale: 1.2})
                .to(0.5, {scale: 1})
            )
            .start()
    }

    // update (dt) {}
}
